package com.etc.controller;

import com.etc.entity.ViewLivein;
import com.etc.service.ViewLiveinService;
import com.etc.util.Layui;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/viewLivein")
public class ViewLiveinController {
    @Autowired
    ViewLiveinService service;

    /**
     * 查询所有入住信息
     * @param page
     * @param limit
     * @param roomNum
     * @param RtName
     * @param adminName
     * @return
     */
    @RequestMapping("/getAllLivein")
    @ResponseBody
    public Layui getAllLivein(@RequestParam(value = "page",defaultValue = "1")int page,
                             @RequestParam(value = "limit",defaultValue = "10")int limit,
                             @RequestParam(value = "roomNum",defaultValue = "")String roomNum,
                             @RequestParam(value = "RtName",defaultValue = "")String RtName,
                             @RequestParam(value = "adminName",defaultValue = "")String adminName){
        PageInfo<ViewLivein> pageInfo=service.getAllLivein(page,limit,roomNum,RtName,adminName);
        return Layui.data(pageInfo.getTotal(),pageInfo.getList());
    }
    /**
     * 修改入住结算信息
     */
    @RequestMapping("/upLivein")
    @ResponseBody
    public boolean upLivein(@RequestParam("IId")String IId){
        boolean flag=service.getLivein(IId);
        return flag;
    }
}
